﻿@inherits EditDrawerBase<SysTimerDto, int>

@if (_editModel != null)
{
    <Form Loading="@_isLoading"
            Model="@_editModel"
            LabelCol="new ColLayoutParam { Span = 8 }"
            WrapperCol="new ColLayoutParam { Span = 16 }"
            OnFinish="OnFormFinish"
            Context="model">
        <FormItem>
            <Input @bind-Value="@model.JobName" />
        </FormItem>
        <FormItem>
            <Input @bind-Value="@model.RequestUrl" />
        </FormItem>
        <FormItem Label="请求类型">
        <RadioGroup @bind-Value="@model.RequestType">
            @foreach (var gitem in EnumHelper.EnumToDictionary<RequestType>())
            {
                <Radio Value="@(gitem.Key)">@gitem.Value</Radio>
            }
        </RadioGroup>
        </FormItem>
         <FormItem>
            <Input @bind-Value="@model.Headers" />
        </FormItem>
        <FormItem>
            <Input @bind-Value="@model.RequestParameters" />
        </FormItem>
        <FormItem>
            <Input @bind-Value="@model.Interval" />
        </FormItem>
        <FormItem>
            <Input @bind-Value="@model.Cron" />
        </FormItem>
        <FormItem Label="定时器类型">
        <RadioGroup @bind-Value="@model.TimerType">
            @foreach (var gitem in EnumHelper.EnumToDictionary<TimerTypes>())
            {
                <Radio Value="@(gitem.Key)">@gitem.Value</Radio>
            }
        </RadioGroup>
        </FormItem>
        <FormItem Label="立即执行">
        <Switch @bind-Value="@model.StartNow"></Switch>
        </FormItem>
        <FormItem Label="只执行一次">
        <Switch @bind-Value="@model.DoOnce"></Switch>
        </FormItem>
        <FormItem Label="执行类型">
        <RadioGroup @bind-Value="@model.ExecuteType">
            @foreach (var gitem in EnumHelper.EnumToDictionary<ExecutType>())
            {
                <Radio Value="@(gitem.Key)">@gitem.Value</Radio>
            }
        </RadioGroup>
        </FormItem>
        <FormItem>
            <Input @bind-Value="@model.Remark" />
        </FormItem>
        @if (this.Options.Type.Equals(DrawerInputType.Edit) || this.Options.Type.Equals(DrawerInputType.Select))
        {
            <FormItem Label="创建时间">
                <span>@model.CreatedTime.ToString(ClientConstant.DateTimeFormat)</span>
            </FormItem>
            <FormItem Label="更新时间">
                <span>@model.UpdatedTime?.ToString(ClientConstant.DateTimeFormat)</span>
            </FormItem>
        }
        <FormItem WrapperColOffset="8" WrapperColSpan="16">
            <Space>
                @if (!DrawerInputType.Select.Equals(this.Options.Type))
                {
                    <SpaceItem>
                        <Button Type="@ButtonType.Primary" HtmlType="submit">
                            @localizer["保存"]
                        </Button>
                    </SpaceItem>
                }
                <SpaceItem>
                    <Button OnClick="_=>OnFormCancel()">
                        @localizer["取消"]
                    </Button>
                </SpaceItem>
            </Space>
        </FormItem>
    </Form>
}
